package com.shadow.baiqun.delegate.room.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shadow.baiqun.R;
import com.shadow.baiqun.config.ItemField;
import com.shadow.baiqun.delegate.room.tilting.ClaimGoodsEntity;
import com.shadow.ui.recycler.MultipleItemEntity;

import java.util.List;

/**
 * @author zhangyu
 * @date 2018/7/13
 */

public class ClaimGoodsAdapter extends BaseQuickAdapter<MultipleItemEntity, BaseViewHolder> {
    private int mColorDone;
    private int mColorUnDeal;

    public ClaimGoodsAdapter(Context context, int layoutResId, @Nullable List<MultipleItemEntity> data) {
        super(layoutResId, data);
        mColorDone = context.getResources().getColor(R.color.color_green);
        mColorUnDeal = context.getResources().getColor(R.color.app_font_color);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultipleItemEntity item) {
        ClaimGoodsEntity entity = item.getField(ItemField.ITEM_OBJ);
//        helper.setText(R.id.tv_part_code, entity.getPartsNum());
//        helper.setText(R.id.tv_part_count, String.valueOf(entity.getPartsTotalnum()));
        helper.setText(R.id.tv_bar_code, entity.getTabNum());
        helper.setText(R.id.tv_part_station, entity.getDepotName());
        int status = entity.getStatu();
        if (status == 1) {
            helper.setText(R.id.tv_state, "已完成");
            helper.setTextColor(R.id.tv_state, mColorDone);
        } else {
            helper.setText(R.id.tv_state, "未完成");
            helper.setTextColor(R.id.tv_state, mColorUnDeal);
        }
    }
}
